/*
* License:  This  program  is  free  software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the  Free Software Foundation; either version 3 of the License, or (at your
* option)  any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*/

package pcgen.CharacterViewer;

import org.apache.commons.lang.StringUtils;

import pcgen.android.app.ApplicationEx;

import pcgen.CharacterViewer.resources.GameFolder;

public class CharacterViewerApplication extends ApplicationEx
{
	@Override
	public String initializeExternalStorageDirectoryName()
	{
		return "DroidPCGenViewer";
	}
	
	public GameFolder getGameFolder()
	{
		return _folder;
	}
	
	public void removeGameFolder()
	{
		_folder = null;
	}
	
	public void setGameFolder(GameFolder folder)
	{
		_folder = folder;
	}
	
	public GameTypes getGameTypes()
	{
		return _gameTypes;
	}
	
	public void setGameTypes(GameTypes gameTypes)
	{
		_gameTypes = gameTypes;
	}
    
    public boolean validateNameCharacters(String value)
    {
    	if (StringUtils.isEmpty(value))
    		return false;
    	
    	//return value.matches("^[a-zA-Z0-9_-\\x32]*$");
    	return value.replace(' ', '_').matches("^[a-zA-Z0-9_-]*$");
    }
    
    public boolean getDebugMode()
    {
    	return true;
    }
	
	private GameFolder _folder;
	private GameTypes _gameTypes;
	
	private static final String TAG = CharacterViewerApplication.class.getSimpleName();
}
